<%@ page language="java" import="java.util.*,com.jpf.demo.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
</head>
<body>
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 订单列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">订单编号</th>
        <th width="10%">用户编号</th>
        <th>商品编号</th>
        <th>下单时间</th>
        <th>收货地址</th>
        <th>收货人电话</th>
        <th>订单金额</th>
        <th>收货人</th>
        <th width="10%">状态</th>
        <th width="310">操作</th>
      </tr>
      <volist name="list" id="vo">
      <c:forEach items="${list1}" var="order">
      <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="${order.oid}" />${order.oid}</td>
          <td>${order.uid}</td>
          <td width="10%">${order.gid}</td>
          <td>${order.otime}</td>
          <td>${order.address}</td>
          <td><font color="#00CC99">${order.phone}</font></td>
          <td>${order.amount}</td>
          <td>${order.consignee}</td>
          <td>${order.status}</td>
          <td><div class="button-group"> <a class="button border-main" href="AlterOrder.do?oid=${order.oid}"><span class="icon-edit"></span> 发货</a> <a class="button border-red" href="javascript:void(0)" onclick="return del(${order.oid})"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
      </c:forEach>
       <tr>
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
        <td colspan="11" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a>
          &nbsp;&nbsp;&nbsp;
      </tr>
      <tr>
        <td colspan="11"><div class="pagelist"> <a href="">上一页</a> <span class="current">1</span><a href="">2</a><a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div></td>
      </tr>
    </table>
  </div>
<script type="text/javascript">

//单个删除
function del(oid){
	if(confirm("您确定要删除吗?")){
		location.href="DeleteOrder.do?action=search&oid="+oid;
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  	}
	  });
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;		
		else{
		 var checkedList = new Array();
         $("input[name='id[]']:checked").each(function(){
         checkedList.push($(this).val());
         });
         $.ajax({
         type:"POST",
         url:"DeleteOrder.do",
         data:{"delorder":checkedList.toString()},
         datatype:"html",
         success:function(data){
         	$("[name='checkbox2']:checkbox").attr("checked",false);
            location.href="QueryOrder.do";//页面刷新
            },
         error:function(data){
            art.dialog.tips('删除失败!');
            }
         });
		}	
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

</script>
</body>
</html>